package com.qall.configserver.constant;

public enum ErrorInfoEnum {

    SUCCESS(ErrorCodeConstant.SUCCESS, ErrorMessageConstant.SUCCESS),
    ERROR(ErrorCodeConstant.ERROR, ErrorMessageConstant.ERROR);

    public byte errorCode;
    public String errorMsg;

    public static ErrorInfoEnum get(byte code) {
        ErrorInfoEnum[] errorInfoEnums = ErrorInfoEnum.class.getEnumConstants();
        for (int i = 0; i < errorInfoEnums.length; i++) {
            if (errorInfoEnums[i].errorCode == code) {
                return errorInfoEnums[i];
            }
        }
        return null;
    }

    ErrorInfoEnum(byte code, String message) {
        errorCode = code;
        errorMsg = message;
    }

}
